package com.lianzhihui.romeex.ui.ipfs;

import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.ui.base.BaseActivity;
import com.lianzhihui.romeex.utils.StatusBarUtil;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.ui.ecological
 * @ClassName: IPFSActivity
 * @Description: java类作用描述
 * @Author: zhanghong
 * @CreateDate: 2020/12/17 9:52
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/12/17 9:52
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class IPFSActivity extends BaseActivity {

    @BindView(R.id.myRecyclerView)
    RecyclerView myRecyclerView;
    @BindView(R.id.ll_range1)
    LinearLayout ll_range1;
    @BindView(R.id.buy_ipfs)
    RelativeLayout buy_ipfs;
    @BindView(R.id.include_top_lin_background)
    LinearLayout includeTopLinBackground;
    private IPFSAdapter ipfsAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_ipfs;
    }

    @Override
    protected void initView() {
        StatusBarUtil.setTransparent(this);
        StatusBarUtil.setStatusBarTextColor(this, false);
        setTitle("IPFS");
        ipfsAdapter = new IPFSAdapter(new ArrayList<>());
        myRecyclerView.setAdapter(ipfsAdapter);
        myRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        includeTopLinBackground.setBackgroundColor(getResources().getColor(R.color.transparent));
        ipfsAdapter.setEmptyView(getEmptyView());
    }

    @Override
    public boolean setFitSystemWindowFlag() {
        return false;
    }

    @Override
    protected void initData() {
        ipfsAdapter.setNewData(new ArrayList<>());
    }

    public static class IPFSAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

        public IPFSAdapter(@Nullable List<String> data) {
            super(R.layout.item_coin_layout, data);
        }

        @Override
        protected void convert(@NonNull BaseViewHolder helper, String item) {

        }
    }

    @OnClick({R.id.buy_ipfs, R.id.ll_range1})
    public void onclick(View v) {
        switch (v.getId()) {
            case R.id.buy_ipfs:
                toast(getString(R.string.text_will_be_open));
                break;
            case R.id.ll_range1:
                startActivity(new Intent(this, IPFSMadeInfoActivity.class));
                break;
            default:
                break;
        }
    }
}
